package com.flx.sentinel.handler;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.flx.common.utils.result.ResultResponse;
import lombok.extern.slf4j.Slf4j;

/**
 * @Author Fenglixiong
 * @Create 2022/4/23 20:12
 * @Description
 **/
@Slf4j
public class DefaultFallbackHandler {

    /**
     * 全局异常处理器，参数和返回值一定要对上比如参数name，返回值ResultResponse，不然匹配不到
     * @return
     */
    public static ResultResponse helloFallBack(String name,Throwable e){
        log.info("【全局降级】您访问出错了，请稍后再试一下哦,error = {}",e.getMessage());
        return ResultResponse.error("您访问出错了，请稍后再试一下哦！param = "+name);
    }

}
